package com.woniuxy.light_smart.controller;

import com.woniuxy.light_smart.entity.Error;
import com.woniuxy.light_smart.service.ErrorService;
import com.woniuxy.light_smart.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("err")
public class ErrorController {
    @Autowired
    private ErrorService errorService;

    @GetMapping("")
    public Result getError(){
        Error error = errorService.selectByPrimaryKey(1L);
        return Result.ok().data("error",error);
    }

    @PostMapping("update")
    public Result updateError(@RequestBody Error error){
         errorService.updateByPrimaryKeySelective(error);
         return  Result.ok();
    }
}
